﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using Antu.WebControls;
using Antu.Core.Components;
using Antu.Core.Services;
using System.Web.UI.WebControls;
using EluZSProvider;
using System.Web;
using System.Data;
namespace WebSys.UI.Control.ZhengShou
{
    public class ZSPG_TSLXFWBZControl : MPBasicTemplate
    {
        EluZSDataProvider _EluZSDataProvider = (EluZSDataProvider)ProviderService.ProviderServiceMange.GetProvider("EluZSProvider");
        public string userid = string.Empty;
        protected override void OnLoad(EventArgs e)
        {

            if (HttpContext.Current.Session["UserID"] == null)
            {
                Antu.Utilities.UtilitiesPage.AlertDialogClear("登录超时，请重新登录！", "window.parent.location.href('../login.aspx');");
            }
            else
            {
                userid = HttpContext.Current.Session["UserID"].ToString();
            }
            base.OnLoad(e);
            MPPersistence Persistence1 = (MPPersistence)FindControl("Persistence1");
            Panel panel1 = (Panel)FindControl("panel1");
            if (!base.Page.IsPostBack)
            {

                Persistence1.Table = "zs_TSLXFWBZ";
                Persistence1.Key = "ID";
                Persistence1.KeyValue = HttpContext.Current.Request["id"];
                Persistence1.ConnStr = _EluZSDataProvider.GetConnectionString();
            }
            Persistence1.BindControl = panel1;
            DataBind();
            Button btn_save = (Button)FindControl("btn_save");
            btn_save.Click += new EventHandler(btn_save_Click);
        }

        protected void btn_save_Click(object sender, EventArgs e)
        {
            MPPersistence Persistence1 = (MPPersistence)FindControl("Persistence1");
            Persistence1.Update();
            Page.ClientScript.RegisterStartupScript(this.GetType(), "s1", "<script>alert('保存成功!');</script>");
            Page.Response.Redirect("ZSPG_TSLXFWBZ.aspx?Id="+Persistence1.KeyValue+"");
        }


        public override void DataBind()
        {
            
        }
    }
}
